<% content_for :sidebar do %>
  <h2>Requirement</h2>
  <%= sidebar_button_link 'Edit Requirement',
           edit_requirement_path(@requirement) if can? :edit, @requirement %>
  <%= sidebar_button_link "New Assignment",
           new_requirement_assignment_path(@requirement) if can? :create, Assignment %>
<% end %>

<ol class="breadcrumb">
  <li class="breadcrumb-item"><%= link_to 'Events', events_path %></li>
  <li class="breadcrumb-item"><%= link_to @requirement.task.event.title, event_path(@requirement.task.event) %></li>
  <li class="breadcrumb-item"><%= link_to @requirement.task.title, task_path(@requirement.task)%></li>
  <li class="breadcrumb-item active"><%= @requirement.title.presence || @requirement.skill.presence || 'requirement' %></li>
</ol>

<p>
  <span class="h4">
    <% if @requirement.title.present? %>
      <%= @requirement.title %>
    <% elsif @requirement.skill.present? %>
      <%= @requirement.skill %>
    <% end %>
  </span><br>

  <% if @requirement.task.location.present? %>
    at <%= @requirement.task.location %>
  <% end %>
  (<%= format_time_span(@requirement.task.start_time, @requirement.task.end_time) %>)
</p>

<p><%= requirement_status_label(@requirement) %> (personnel requirements met: <%= @requirement.number_filled %>/<%= @requirement.desired_people %> desired)</p>
<p>
  <b>Assigned People:</b> <%= @requirement.number_filled %><br>
  <b>Minimum People:</b> <%= @requirement.minimum_people %><br>
  <b>Desired People:</b> <%= @requirement.desired_people %><br>
  <b>Maximum People:</b> <%= @requirement.maximum_people %>
</p>
<p>
  <b>Auto-assign:</b> <%= @requirement.auto_assign ? "Yes" : "No" %><br>
  <b>Optional:</b> <%= @requirement.optional ? "Yes" : "No" %><br>
  <b>Floating:</b> <%= @requirement.floating ? "Yes" : "No" %>
</p>

<%= render(partial: "assignments/assignments_table",
           locals: { assignments: @requirement.assignments,
                     title: "Assignments" }) || "No Assignments Yet !" %>
